home *** CD-ROM | disk | FTP | other *** search
- Path: uunet!island!argv
- From: argv@island.uu.net (Dan Heller)
- Newsgroups: comp.sources.x
- Subject: v04i007: board.h for Dragon
- Message-ID: <770@island.uu.net>
- Date: 26 May 89 05:54:36 GMT
- Sender: news@island.uu.net
- Organization: Island Graphics, Marin County, California
- Lines: 113
- Approved: island!argv@sun.com
-
- Submitted-by: Gary Barnes
- Posting-number: Volume 4, Issue 7
- Archive-name: dragon/board.h
-
- [ sorry I missed posting this --argv ]
-
- /******************************************************************************
- * Dragon - a version of Mah-Jongg for X Windows
- *
- * Author: Gary E. Barnes May 1989
- *
- * board.h - #include'ed into source files dealing with the playing surface
- ******************************************************************************/
-
- #ifdef _BOARD_C_
- #define VAR(A) A
- #define VARI(A,B) A = B
- #else
- #define VAR(A) extern A
- #define VARI(A,B) extern A
- #endif
-
-
- /******************************************************************************
- * Global State
- ******************************************************************************/
-
- #define NFACES 42 /* number of distinct tile faces */
- #define NTILES ((NFACES-8) * 4 + 8) /* number of distinct tiles in game */
- #define NROWS 8 /* number of rows in game */
- #define NCOLS 16 /* number of columns in game */
- #define NO_TILE 0 /* tile codes are 1..NFACES */
-
- /*--Size of the Board. */
-
- VARI( int Board_Width, 29 * 15 + 1 + 8 );
- VARI( int Board_Height, 33 * 10 + 1 + 8 );
- VARI( int Score, NTILES);
-
- /*--X/Y coordinate of a tile at coord 0,0 of the playing surface. */
-
- VARI( int Board_Tile0_X, 4 );
- VARI( int Board_Tile0_Y, 4 + 2 * 33 );
-
- /*--Actual size of a tile, not counting the border around it. */
-
- VARI( unsigned int Tile_Width, 28 );
- VARI( unsigned int Tile_Height, 32 );
-
- /*--X depth and Y width of a shadowed area above/to-the-right-of a tile. */
-
- VARI( int Shadow_X, 28 / 8 );
- VARI( int Shadow_Y, 32 / 8 );
-
- /*--X depth and Y width of tile edge below/to-the-left-of a tile. */
-
- VARI( int Side_X, (28 / 10) & ~1 );
- VARI( int Side_Y, (32 / 10) & ~1 );
-
- /*--Each playing tile position is represented by one of these. */
-
- typedef struct _Board_Position {
- char tiles[4]; /* at most 4 tiles at one position */
- Boolean draw; /* TRUE if needs drawing */
- int level; /* how many tiles do we have */
- int x; /* x coord of tile */
- int y; /* x coord of tile */
- } Board_Position_Rec, *Board_Position;
-
- #define Board_Position_NULL ((Board_Position)0)
-
- VAR( Board_Position_Rec Board_Tiles[NROWS][NCOLS] );
-
- #define SPEC1 0][14 /* farthest right odd tile */
- #define SPEC1row 0 /* farthest right odd tile */
- #define SPEC1col 14 /* farthest right odd tile */
- #define SPEC2 2][14 /* next farthest right odd tile */
- #define SPEC2row 2 /* next farthest right odd tile */
- #define SPEC2col 14 /* next farthest right odd tile */
- #define SPEC3 4][14 /* farthest left odd tile */
- #define SPEC3row 4 /* farthest left odd tile */
- #define SPEC3col 14 /* farthest left odd tile */
- #define SPEC4 6][14 /* center piece tile */
- #define SPEC4row 6 /* center piece tile */
- #define SPEC4col 14 /* center piece tile */
-
- /*--Record tile clicks and watch for double clicks. */
-
- VARI( Boolean One_Button_Hint, FALSE );
- VARI( Board_Position Click1, Board_Position_NULL);
- VAR( int Click1_Row );
- VAR( int Click1_Col );
- VARI( Board_Position Click2, Board_Position_NULL );
- VAR( int Click2_Row );
- VAR( int Click2_Col );
- VAR( Time Click2_Time );
-
-
- /******************************************************************************
- * Procedures declared in board.c or draw.c used by the opposite package.
- ******************************************************************************/
-
- extern void Draw_All_Tiles();
- extern void Hilite_Tile();
- extern void Hints();
- extern void Set_Tile_Controls();
- extern void Setup_New_Game();
- extern void Tile_Press();
- extern void Tile_Release();
- extern void Tile_Remove();
-
- #undef VAR
- #undef VARI
-